package com.orange.cloud.service.inroad.controller;

import com.orange.cloud.service.inroad.entity.JourneyEntity;
import com.orange.cloud.service.inroad.service.IJourneyService;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDateTime;

/**
 * 行程支线
 * @author majie
 * @date 2021/12/18 19:12
 */
@RestController
@RequestMapping("journey")
public class JourneyController {

    @Resource
    private IJourneyService iJourneyService;

    @RequestMapping("add")
    public JourneyEntity addJourney(){
        JourneyEntity journeyEntity=new JourneyEntity();
        journeyEntity.setId(2L);
        journeyEntity.setAgeMaxLimit(1L);
        journeyEntity.setAgeMinLimit(100);
        journeyEntity.setCreateUserId(-1L);
        journeyEntity.setName("测试行程！");
        journeyEntity.setGmtCreate(LocalDateTime.now());
        journeyEntity.setGmtModified(LocalDateTime.now());
        journeyEntity.setStartPoint("贵阳");
        journeyEntity.setEndPoint("西藏");
        iJourneyService.save(journeyEntity);
        return journeyEntity;
    }

}
